@extends('app')
@include('UEditor::head')
@section('content')
<ul class="nav nav-tabs">
    <li><a href="{{ url('/admin/enterprise/jobs/index')}}">信息列表</a></li>
    <li class="active"><a href="#">信息编辑</a></li>
</ul>
<form id="jobsForm" method="post">
    <div class="panel panel-default description2 mt20">
        <div class="form-group">
            <div class="col-sm-2 control-label">职位名称：</div>
            <div class="col-sm-6">
                <input type="text" class="form-control" name="name" id="name" placeholder="职位名称" >
            </div>
            <div class="clear"></div>
        </div>
        <div class="form-group">
            <div class="col-sm-2 control-label">企业名称：</div>
            <div class="col-sm-6">
                <select name="company_id" class="form-control">
                    @foreach($companys as $comp)
                    <option value="{{ $comp->id }}">{{ $comp->name }}</option>
                    @endforeach
                </select>            
            </div>
            <div class="clear"></div>
        </div>
        <div class="form-group">
            <div class="col-sm-2 control-label">职位类型：</div>
            <div class="col-sm-6 form-inline">
                <select name="parentId" class="form-control" onchange="jobstype(this.value,'companyjobtype')">
                    @foreach($jobsType as $jobst)
                    <option value="{{ $jobst->cat_id }}">{{ $jobst->name }}</option>
                    @endforeach
                </select>
                <select  name="catId" class="form-control" id="catId">
                    <option value="0">请选择分类</option>
                </select>
            </div>
            <div class="clear"></div>
        </div>
        <div class="form-group">
            <div class="col-sm-2 control-label">任职地区：</div>
            <div class="col-sm-6 form-inline">
                <select name="parentArea" class="form-control" onchange="childAreas(this.value,'areas')">
                    @foreach($areas as $area)
                    <option value="{{ $area->area_id }}">{{ $area->title }}</option>
                    @endforeach
                </select>
                
                <select name="area" class="form-control" id="area">
                    <option value="0">请选择分类</option>
                </select>
            </div>
            <div class="clear"></div>
        </div>
        <div class="form-group">
            <div class="col-sm-2 control-label">薪资要求：</div>
            <div class="col-sm-6">
                <select name="salary" class="form-control">
                    @foreach($salary as $key=>$sa)
                    <option value="{{ $key }}">{{$sa}}</option>
                    @endforeach
                </select>
            </div>
            <div class="clear"></div>
        </div>
        <div class="form-group">
            <div class="col-sm-2 control-label">学历要求：</div>
            <div class="col-sm-6">
                <select name="degree" class="form-control">
                    @foreach($degree as $key=>$dg)
                    <option value="{{ $key }}" >{{ $dg }}</option>
                    @endforeach
                </select>
            </div>
            <div class="clear"></div>
        </div>
        <div class="form-group">
            <div class="col-sm-2 control-label">工作年限：</div>
            <div class="col-sm-6">
                <select name="gznx" class="form-control">
                    @foreach($gznx as $key=>$gz)
                    <option value="{{ $key }}" >{{ $gz }}</option>
                    @endforeach
                </select>
            </div>
            <div class="clear"></div>
        </div>
        <div class="form-group">
            <div class="col-sm-2 control-label">工作性质：</div>
            <div class="col-sm-6">
                <select name="gzxz" class="form-control">
                    @foreach($gzxz as $key=>$gxz)
                    <option value="{{ $key }}">{{ $gxz }}</option>
                    @endforeach
                </select>
            </div>
            <div class="clear"></div>
        </div>
        <div class="form-group">
            <div class="col-sm-2 control-label">招聘人数:</div>
            <div class="col-sm-10">
                <input type="number" name="recruitment" class="form-control" value="{{empty($result)?0:$result->recruitment}}">
                <div class="help-block">为0则不限制</div>
            </div>
            <div class="clear"></div>
        </div>
        <div class="form-group">
            <div class="col-sm-2 control-label">职位介绍:</div>
            <div class="col-sm-10">
                <script id="intro" name="intro"  style="width:100%;margin:0 auto;height:200px;" type="text/plain">
                </script>
            </div>
            <div class="clear"></div>
        </div>
        <div class="form-group">
            <div class="col-sm-2 control-label">职位描述:</div>
            <div class="col-sm-10">
                <script id="description" name="description"  style="width:100%;margin:0 auto;height:200px;" type="text/plain">
                </script>
            </div>
            <div class="clear"></div>
        </div>
        <div class="form-group">
            <div class="col-sm-2 control-label">审核状态：</div>
            <div class="col-sm-6">
                <select name="status" class="form-control">
                    @foreach($status as $key=>$sts)
                    <option value="{{ $key }}">{{ $sts }}</option>
                    @endforeach
                </select>
            </div>
            <div class="clear"></div>
        </div>
        <div class="form-group">
            <div class="col-sm-2 control-label">是否开启考试：</div>
            <div class="col-sm-6">
                <label class="radio-inline">
                  <input type="radio" name="test" id="test" value="0" onclick="examinations()" checked> 不开启
                </label>
                <label class="radio-inline">
                  <input type="radio" name="test" id="test" value="1" onclick="examinations()"> 开启
                </label>
            </div>
            <div class="clear"></div>
        </div>
        <div class="form-group" id="examination">
            <div class="col-sm-2 control-label">试卷编号：</div>
            <div class="col-sm-6">
                <select name="examid" class="form-control">
                    
                </select>
            </div>
            <div class="clear"></div>
        </div>
        <input type="hidden" name="user_id" value="{{ Auth::user()->id }}">
        {!! csrf_field() !!}
        <input type="hidden" name="jobs_id" value="0">
        <input type="hidden" name="blademode" value="{{ $blademode }}">
        <div class="form-inline">
            <div class="form-group col-xs-offset-1">
              <button type="button" class="btn btn-info" onclick="saveData('/admin/enterprise/jobs/index','jobsForm')">
                    <i class="icon-ok bigger-110"></i>
                    Submit
              </button>
            </div>
            <div class="form-group col-xs-offset-1">
                <button type="reset" class="btn">
                    <i class="icon-undo bigger-110"></i>
                    Reset
                </button>
            </div>
        </div>
    </div>
</form>

<script type="text/javascript">
<!--
var ue = UE.getEditor('intro');
ue.ready(function() {
	ue.execCommand('serverparam', '_token', '{{ csrf_token() }}');//此处为支持laravel5 csrf ,根据实际情况修改,目的就是设置 _token 值. 
});
var ue1 = UE.getEditor('description');
ue1.ready(function() {
	ue1.execCommand('serverparam', '_token', '{{ csrf_token() }}');//此处为支持laravel5 csrf ,根据实际情况修改,目的就是设置 _token 值. 
});

function examinations()
{
	if($('input[name=test]:checked').val() == 1)
	{
		$("#examination").show();
	}
	else
	{
		$("#examination").hide();
	}
}

$(function(){
	examinations();
	childAreas($('select[name=parentArea]').val(),'areas');
	jobstype($('select[name=parentId]').val(),'companyjobtype')
});
//-->
</script>
@endsection
